package com.bdqn.design.proxy;

/**
 * IntermediaryProxyBuyerImpl 房产中介代理买房
 *
 * @author LILIBO
 * @since 2024/7/6
 */
public class IntermediaryProxyBuyerImpl implements Buyer {

    // 定义真实买房的对象
    private Buyer target;

    public IntermediaryProxyBuyerImpl(Buyer target) {
        this.target = target;
    }

    /**
     * 看房
     *
     * @return
     */
    @Override
    public String havealook() {
        System.out.println("① 联系房东");
        System.out.println("② 预约看房地址和时间");
        System.out.println("③ 小区保安登记");
        System.out.println("④ 上楼开门");

        long start = System.currentTimeMillis();
        String result = target.havealook(); // 带真实买房者去看房
        long end = System.currentTimeMillis();

        System.out.println("⑥ 评价交流");
        System.out.println("⑦ 确定是否买房");

        System.out.println("本次带客户看房一共花了" + (end - start) + "毫秒");
        return "（基于接口代理）" + result;
    }

}
